package cn.zqy.demo2.day06.ThreadSafe;

public class Demo01Ticket {
    public static void main(String[] args) {
        //  模拟卖票案例
        //    创建3个线程,同时开启,对共享的票进行出售
        Runnable run = new RunnableTicketImpl();

        //创建Thread类对象,构造方法中传递Runnable接口的实现类对象
        Thread t1 = new Thread(run);
        Thread t2 = new Thread(run);
        Thread t3 = new Thread(run);

        //调用start方法开启多线程
        t1.start();
        t2.start();
        t3.start();
    }
}
